/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "news_question_answer")
//@NamedQueries({@NamedQuery(name = "NewsQuestionAnswer.findAll", query = "SELECT n FROM NewsQuestionAnswer n"), @NamedQuery(name = "NewsQuestionAnswer.findByQuestionid", query = "SELECT n FROM NewsQuestionAnswer n WHERE n.newsQuestionAnswerPK.questionid = :questionid"), @NamedQuery(name = "NewsQuestionAnswer.findByAnswerid", query = "SELECT n FROM NewsQuestionAnswer n WHERE n.newsQuestionAnswerPK.answerid = :answerid"), @NamedQuery(name = "NewsQuestionAnswer.findByAnswertext", query = "SELECT n FROM NewsQuestionAnswer n WHERE n.answertext = :answertext"), @NamedQuery(name = "NewsQuestionAnswer.findByAnswernum", query = "SELECT n FROM NewsQuestionAnswer n WHERE n.answernum = :answernum"), @NamedQuery(name = "NewsQuestionAnswer.findByAnswerpoint", query = "SELECT n FROM NewsQuestionAnswer n WHERE n.answerpoint = :answerpoint")})
public class NewsQuestionAnswer implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected NewsQuestionAnswerPK newsQuestionAnswerPK;
    @Column(name = "answertext")
    private String answertext;
    @Column(name = "answernum")
    private String answernum;
    @Column(name = "answerpoint")
    private Integer answerpoint;
    @JoinColumn(name = "questionid", referencedColumnName = "questionid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NewsQuestion newsQuestion;

    public NewsQuestionAnswer() {
    }

    public NewsQuestionAnswer(NewsQuestionAnswerPK newsQuestionAnswerPK) {
        this.newsQuestionAnswerPK = newsQuestionAnswerPK;
    }

    public NewsQuestionAnswer(int questionid, int answerid) {
        this.newsQuestionAnswerPK = new NewsQuestionAnswerPK(questionid, answerid);
    }

    public NewsQuestionAnswerPK getNewsQuestionAnswerPK() {
        return newsQuestionAnswerPK;
    }

    public void setNewsQuestionAnswerPK(NewsQuestionAnswerPK newsQuestionAnswerPK) {
        this.newsQuestionAnswerPK = newsQuestionAnswerPK;
    }

    public String getAnswertext() {
        return answertext;
    }

    public void setAnswertext(String answertext) {
        this.answertext = answertext;
    }

    public String getAnswernum() {
        return answernum;
    }

    public void setAnswernum(String answernum) {
        this.answernum = answernum;
    }

    public Integer getAnswerpoint() {
        return answerpoint;
    }

    public void setAnswerpoint(Integer answerpoint) {
        this.answerpoint = answerpoint;
    }

    public NewsQuestion getNewsQuestion() {
        return newsQuestion;
    }

    public void setNewsQuestion(NewsQuestion newsQuestion) {
        this.newsQuestion = newsQuestion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (newsQuestionAnswerPK != null ? newsQuestionAnswerPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewsQuestionAnswer)) {
            return false;
        }
        NewsQuestionAnswer other = (NewsQuestionAnswer) object;
        if ((this.newsQuestionAnswerPK == null && other.newsQuestionAnswerPK != null) || (this.newsQuestionAnswerPK != null && !this.newsQuestionAnswerPK.equals(other.newsQuestionAnswerPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.NewsQuestionAnswer[newsQuestionAnswerPK=" + newsQuestionAnswerPK + "]";
    }

}
